﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="MenuSelectPage.aspx.cs" Inherits="Project_Udrinkwater.MenuSelectPage" %>

<%@ Register Assembly="DevExpress.Web.v12.2, Version=12.2.5.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a"
    Namespace="DevExpress.Web.ASPxImageSlider" TagPrefix="dx" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
     <script type="text/javascript">
    // <![CDATA[
         function ShowLoginWindow() {
             pcLogin.Show();}
       
    // ]]> 
    </script>
    <script type="text/javascript">
        var isPlayed = false;
        var timer;

        function GetTimeout(itemName) {
            var defaultTimeout = 1000;
            return hiddenField.Contains(itemName) ? hiddenField.Get(itemName) : defaultTimeout;
        }

        function Play() {
            if (!isPlayed) {
                var item = imageSlider.GetActiveItem();

                timer = setTimeout(function () {
                    var nextItemIndex = (item.index + 1) % imageSlider.GetItemCount();
                    imageSlider.SetActiveItemIndex(nextItemIndex);
                }, GetTimeout(item.name));

                isPlayed = true;
            }
        }

        function Pause() {
            if (isPlayed) {
                clearTimeout(timer);
                isPlayed = false;
            }
        }

        function ItemChanged() {
            if (isPlayed) {
                clearTimeout(timer);
                isPlayed = false;
                Play();
            }
        }




        // Handlers

        function imageSlider_Init(s, e) {
            Play();
        }

        function imageSlider_ActiveItemChanged(s, e) {
            ItemChanged();
        }

        function btPlay_Click(s, e) {
            if (isPlayed) {
                Pause();
                s.SetText("Play");
            }
            else {
                Play();
                s.SetText("Pause");
            }
        }
    </script>
    <style type="text/css">
        .pcmSideSpacer
        {
            height: 14px;
            width: 13px;
        }
        .style2
        {
            width: 100%;
        }
        .style3
        {
            width: 93px;
        }
        .body {
            background: url('Images/bg_Menu.png')no-repeat center center fixed;
            -webkit-background-size: cover;
        -moz-background-size: cover;
        -o-background-size: cover;
        background-size: cover;
        }
       
        </style>
</head>
<body class="body">
    
    <form id="form1" runat="server">
  <div align="center" style="margin-top: 150px">
         <dx:ASPxHiddenField ID="hfCustomIntervals" runat="server" ClientInstanceName="hiddenField"
            OnInit="hfCustomIntervals_Init">
        </dx:ASPxHiddenField>
         <%-- <dx:ASPxButton ID="btPlay" runat="server" Text="Pause" AutoPostBack="false">
            <ClientSideEvents Click="btPlay_Click" />
        </dx:ASPxButton>--%>
         <dx:ASPxImageSlider ID="imageSlider" runat="server" ClientInstanceName="imageSlider" Width="500px" Height="428">
            <ClientSideEvents Init="imageSlider_Init" ActiveItemChanged="imageSlider_ActiveItemChanged" />
            <SettingsImageArea ItemTextVisibility="Always" 
                NavigationButtonVisibility="None" />
            <SettingsNavigationBar Mode="Dots" />
            <Items>
                <dx:ImageSliderItem ImageUrl="~/Images/1079373_138198436391499_2082775009_n.jpg" 
                    Name="UD1" Text="Cherries (Timeout: 2 sec)">
                </dx:ImageSliderItem>
                <dx:ImageSliderItem ImageUrl="~/Images/1080621_138202419724434_2104218538_n.jpg" 
                    Name="UD2" Text="Raspberry (Timeout: 5 sec)">
                </dx:ImageSliderItem>
                <dx:ImageSliderItem ImageUrl="~/Images/51b03a2174096330e07351377098b1a5.jpg" 
                    Name="UD3" Text="Strawberry (Timeout: 1 sec)">
                </dx:ImageSliderItem>
                <dx:ImageSliderItem ImageUrl="~/Images/l_133922857825.jpg" Name="UD4" 
                    Text="Tomatoes (Timeout: 4 sec)">
                </dx:ImageSliderItem>
            </Items>
        </dx:ASPxImageSlider>
    </div>
    <div align="center">
        
        <table align="center">
            <tr>
                <td>
                    <dx:ASPxButton ID="Bt_PageCustomer" runat="server" Text="เข้าหน้าเว็บไซต์" 
                        Theme="SoftOrange" Height="40px" Width="120px" 
                        onclick="Bt_PageCustomer_Click">
                    </dx:ASPxButton>
                </td>
                <td>
                    <dx:ASPxButton ID="Bt_PageAdmin" runat="server" Text="เข้าสู่ระบบ" 
                        Theme="Office2003Blue" Height="40px" Width="120px">
                         <ClientSideEvents Click="function(s, e) { ShowLoginWindow(); }" />
                    </dx:ASPxButton>
                </td>
            </tr>
        </table>
    </div>
     <dx:ASPxPopupControl ID="pcLogin" runat="server" CloseAction="CloseButton" Modal="True"
        PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter" ClientInstanceName="pcLogin"
        HeaderText="Login" AllowDragging="True" PopupAnimationType="None" EnableViewState="False" 
                                Width="325px">
        <ClientSideEvents PopUp="function(s, e) { ASPxClientEdit.ClearGroup('entryGroup'); tbLogin.Focus(); }" />
        <ContentCollection>
            <dx:PopupControlContentControl ID="PopupControlContentControl1" runat="server">
                <dx:ASPxPanel ID="Panel1" runat="server" DefaultButton="btOK">
                    <PanelCollection>
                        <dx:PanelContent ID="PanelContent1" runat="server">
                            <table>
                                <tr>
                                    <td rowspan="4">
                                        <div class="pcmSideSpacer">
                                        </div>
                                    </td>
                                    <td class="style3" align="right">
                                        <dx:ASPxLabel ID="lblUsername1" runat="server" Text="ชื่อผู้ใช้:" 
                                            AssociatedControlID="tbLogin" Font-Size="Medium">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCellText">
                                        <dx:ASPxTextBox ID="tbLogin" runat="server" Width="150px" ClientInstanceName="tbLogin">
                                            <ValidationSettings EnableCustomValidation="True" ValidationGroup="entryGroup" SetFocusOnError="True"
                                                ErrorDisplayMode="Text" ErrorTextPosition="Bottom" CausesValidation="True">
                                                <RequiredField ErrorText="Username required" IsRequired="True" />
                                                <RegularExpression ErrorText="Login required" />
                                                <ErrorFrameStyle Font-Size="10px">
                                                    <ErrorTextPaddings PaddingLeft="0px" />
                                                </ErrorFrameStyle>
                                            </ValidationSettings>
                                        </dx:ASPxTextBox>
                                    </td>
                                    <td rowspan="4">
                                        <div class="pcmSideSpacer">
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3" align="right" >
                                        <dx:ASPxLabel ID="lblPass1" runat="server" Text="รหัสผ่าน:" 
                                            AssociatedControlID="tbPassword" Font-Size="Medium">
                                        </dx:ASPxLabel>
                                    </td>
                                    <td class="pcmCellText">
                                        <dx:ASPxTextBox ID="tbPassword" runat="server" Width="150px" Password="True">
                                            <ValidationSettings EnableCustomValidation="True" ValidationGroup="entryGroup" SetFocusOnError="True"
                                                ErrorDisplayMode="Text" ErrorTextPosition="Bottom">
                                                <RequiredField ErrorText="Password required" IsRequired="True" />
                                                <ErrorFrameStyle Font-Size="10px">
                                                    <ErrorTextPaddings PaddingLeft="0px" />
                                                </ErrorFrameStyle>
                                            </ValidationSettings>
                                        </dx:ASPxTextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td class="style3">
                                        &nbsp;</td>
                                    <td class="pcmCheckBox">
                                        <table class="style2">
                                            <tr>
                                                <td>
                                                    <dx:ASPxButton ID="btOKCustomer" runat="server" AutoPostBack="False" 
                                                        OnClick="btOKCustomer_Click" style="float: left; margin-right: 8px" Text="ตกลง" 
                                                        Width="80px" Font-Size="Medium">
                                                        <ClientSideEvents Click="function(s, e) { if(ASPxClientEdit.ValidateGroup('entryGroup')) pcLogin.Hide(); }" />
                                                    </dx:ASPxButton>
                                                </td>
                                                <td>
                                                    <dx:ASPxButton ID="btCancelCustomer" runat="server" AutoPostBack="False" 
                                                        style="float: left; margin-right: 8px" Text="ยกเลิก" Width="80px" 
                                                        Font-Size="Medium">
                                                        <ClientSideEvents Click="function(s, e) { pcLogin.Hide(); }" />
                                                    </dx:ASPxButton>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <div class="pcmButton">
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </dx:PanelContent>
                    </PanelCollection>
                </dx:ASPxPanel>
                <div>
                    
                </div>
            </dx:PopupControlContentControl>
        </ContentCollection>
        <ContentStyle>
            <Paddings PaddingBottom="5px" />
        </ContentStyle>
    </dx:ASPxPopupControl>
    </form>
</body>
</html>
